package bTree.LeetCode;

public class 买卖股票的最佳时机II {
    public int maxProfit(int[] prices) {
        int sum=0;
        int length = prices.length;
        for (int i = 1; i < length; i++) {
            if(prices[i]>prices[i-1]){
                sum+=prices[i]-prices[i-1];
            }
        }
        return sum;
    }
}